<template>
	<div class="goods">
		<!-- 导航 -->
		<van-nav-bar
			title="商品展示"
			fixed
			safe-area-inset-top
			:z-index="5"
			placeholder
			left-arrow
			left-text="返回"
			@click-left="$router.back()"
			@click-right="$router.push('/')"
		>
			<template #right>
				<van-icon name="wap-home-o" size="20" />
			</template>
		</van-nav-bar>
		<!-- 商品 -->
		<div class="goods">
			<MyGoods
				style="margin-top: 10px;"
				v-for="item in goodsList"
				:key="item.id"
				:goods="item"
			></MyGoods>
		</div>
	</div>
</template>

<script>
import { getGoods } from '@/apis/index.js';
import MyGoods from '@/components/MyGoods.vue';
export default {
	components: {
		MyGoods
	},
	async created() {
		this.goodsList = (await getGoods(1)).data.message;
	},
	data() {
		return {
			goodsList: []
		};
	}
};
</script>

<style scoped lang="less">
.goods {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
}
</style>
